﻿using Dapr.Client;

using var daprclient = new
DaprClientBuilder().UseGrpcEndpoint("http://localhost:60001").Build();
while (true)
{
    var data = new
    {
        OrderId = Random.Shared.Next().ToString(),
        ProductId = Random.Shared.Next().ToString(),
        Amount = Random.Shared.Next(1, 10)
    };
    await daprclient.PublishEventAsync("pubsub", "newOrder", data);
    await Task.Delay(TimeSpan.FromSeconds(3)); 
}
// dapr run --app-id mypub --dapr-http-port 3506 --dapr-grpc-port 60001 --app-port 5006  dotnet run